package com.hxx.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hxx.entity.DailyTrainStationEntity;
import com.hxx.mapper.DailyTrainStationMapper;
import com.hxx.service.DailyTrainStationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class DailyTrainStationServiceImpl extends ServiceImpl<DailyTrainStationMapper, DailyTrainStationEntity>
        implements DailyTrainStationService {

    @Autowired
    private DailyTrainStationMapper dailyTrainStationMapper;
    @Override
    public Page<DailyTrainStationEntity> listPage(Page<DailyTrainStationEntity> page, DailyTrainStationEntity dailyTrainStation) {
        return dailyTrainStationMapper.selectPage(page,new LambdaQueryWrapper<DailyTrainStationEntity>()
                .eq(dailyTrainStation.getTrainCode()!=null,DailyTrainStationEntity::getTrainCode,dailyTrainStation.getTrainCode())
                .eq(dailyTrainStation.getDate()!=null,DailyTrainStationEntity::getDate,dailyTrainStation.getDate())
        );
    }
}
